/** 导出相关的接口 */
import axios from 'axios';
import { getVersion } from '../utils/request';
import config from '../configs/config';
import makeApi from './index';

export const api = {
	productCategoryExport: '/product/productCategory/export',
	productExport: '/product/product/export',
  testResultExport: '/devTestResult/export',
};

makeApi(api);

const services = {};
for (const k in api) {
	services[k] = function (data, onDownloadProgress) {
		return axios.post(api[k], {
			appKey: config.appKey,
			data,
			version: getVersion(api[k])
		}, {
				responseType: 'blob',
				onDownloadProgress,
				headers: {
					Version: getVersion(api[k])
				}
			});
	};
}


const {
	login,
	logout,
	query,
} = services;

export {
	login,
	logout,
	query,
};

export default services;
